<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
  	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	  <#include "/common/plateform/include/common-base.ftl">
    <title>页面内容编辑-iframe窗体ftl</title>
	<script type="text/javascript" charset="utf-8" src="${ctx}/js/ueditor-pagedit/ueditor.config.pagedit.js"></script>
	<script type="text/javascript" charset="utf-8" src="${ctx}/js/ueditor-pagedit/ueditor.all.js"> </script>
	<script type="text/javascript" src="${ctx}/js/ueditor-pagedit/lang/zh-cn/zh-cn.js" ></script>
  </head>
  <body>
<div class="content" style="border:1px #f0f0f0 solid;">
	   <div class="form-group">
	       	<textarea id="content" style="width:0%;height:0px;display:none;" name="content"></textarea>
	    	<script id="editorId" type="text/plain"  style="width:100%;height:290px;"></script>
	   </div>
	   <div class="form-group text-center">
	       <button class="btn btn-primary" onclick="saveDesign()"><i class="fa fa-check"></i> 设计完成</button>
	   </div>
   <script type="text/javascript">
   var type="${type}";
   console.log('ueditor-iframe.ftl.type',type);
   var perviewDivObj = parent.thisCtrTable;
   if(perviewDivObj){
	   perviewDivObj.find("td").each(function(){
			$(this).children().removeClass("has-feedback");//移除子元素定义has-feedback的class值
			$(this).find("small").remove();//移除子元素small（是反显事所带的验证）
			$(this).find("i[class='form-control-feedback']").remove();//移除子元素i（是反显事所带的验证）
		});
   }
   	var ue = UE.getEditor("editorId");//初始化对象  
    ue.ready(function() {//编辑器初始化后完成再赋值  
        if(!strUtil.isNull(perviewDivObj.html())){
        	var varData = perviewDivObj.html().replace("&nbsp;","");
			ue.setContent(varData);
		}
    });
   	
   	function saveDesign(){
   		var textContent =UE.getEditor("editorId").getContent();
   		var obj = {};
   		obj.content=textContent;
   		parent.preDisplayFormContent(obj,type);
   	}
   </script>
</div>
</body>
</html>
